<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { useRouter } from 'vue-router'
//结构pinia
import { useMainStore } from '@/store/index'
const mainStore = useMainStore()
const updateName = ()=>{
  // $patch 修改 store 中的数据
  mainStore.$patch({
    name: '名称被修改了,nameLength也随之改变了'
  })
}
console.log(import.meta.env.VITE_APP_WEB_URL)
</script>
<template>
  <!-- <div>{{mainStore.name}}</div> -->
  <div>用户名:{{ mainStore.name }}<br />长度:{{ mainStore.nameLength }}</div>
  <hr/>
  <button @click="updateName">修改store中的name</button>
</template>
<style lang="scss" scoped>
</style>
